package com.example.req;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

public class UserSaveRep {

    private Long id;
    @NotNull(message = "【loginName】不能为空")
    private String loginName;
    @NotNull(message = "【name】不能为空")
    private String name;

    @NotNull(message = "【password】不能为空")
    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,32}$", message = "【密码】至少包含 数字和英文，长度6-32")
    private String password;

    public UserSaveRep(Long id, String loginName, String name, String password) {
        this.id = id;
        this.loginName = loginName;
        this.name = name;
        this.password = password;
    }

    public UserSaveRep() {
        super();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName == null ? null : loginName.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }
}